<?php
require_once 'tryPHP/preload.php';
$routeData=array();
$pagination=get('page');
$pageSize=10;
$urlArguments=array();
$sqlArguments=array();
//--
$sql=sprintf('SELECT * FROM %s WHERE 1=1',$db->Table('product'));
if(is_numeric_int(get('class'))){
    $class=$urlArguments['class']=$sqlArguments[]=get('class');
    $sql.=' AND class=?';
}
if(is_numeric(get('price_min'))){
    $priceMin=$urlArguments['price_min']=$sqlArguments[]=get('price_min');
    $sql.=' AND price>=?';
}
if(is_numeric(get('price_max'))){
    $priceMax=$urlArguments['price_max']=$sqlArguments[]=get('price_max');
    $sql.=' AND price<=?';
}
if(get('label')){
    $label=$urlArguments['label']=$sqlArguments[]=urldecode(get('label'));
    $sql.=' AND FIND_IN_SET(?,label)';
}
if(request('keywords')){
    $keywords=$urlArguments['keywords']=urldecode(request('keywords'));
    $sqlArguments[]='%'.$keywords.'%';
    $sql.=' AND title LIKE ?';
}
$sql.=' ORDER BY id DESC';
//--
$routeData=$db->getLimit($sql,$pagination,$pageSize,$sqlArguments);
?>

<?php
$linkParameters=array('price_min'=>NULL,'price_max'=>NULL);
commonSelectedParameters($urlArguments,$linkParameters,$selectedStyle); //$selectedStyle选中后的样式
commonUrlParameters($urlArguments,$linkParameters,currentScriptName());
echo $routeData['Meta']['RowCount'];
echo $routeData['Meta']['PageSize'];
echo $routeData['Meta']['PageCount'];
echo $routeData['Meta']['Pagination'];
echo commonPagerParameters($urlArguments);
?>